package org.jeecg.modules.kuner.vipgoodusertime.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.kuner.vipgoodusertime.entity.KrGoodUserTime;
import org.jeecg.modules.kuner.vipgoodusertime.mapper.KrGoodUserTimeMapper;
import org.jeecg.modules.kuner.vipgoodusertime.service.IKrGoodUserTimeService;
import org.springframework.stereotype.Service;

import java.util.Date;


/**
 * @author
 * @Classname IKrGoodUserTimeImpl
 * @Created by
 * @desccription
 */

@Service
public class KrGoodUserTimeImpl extends ServiceImpl<KrGoodUserTimeMapper, KrGoodUserTime> implements IKrGoodUserTimeService {


  @Override
  public void createKr(String userId , String goodId ) {
    KrGoodUserTime krGoodUserTime = new KrGoodUserTime();
    krGoodUserTime.setGoodId(goodId);
    krGoodUserTime.setUserId(userId);
    // todo 这里为什么还是取的当前时间？这样买完会员就超时了？
    krGoodUserTime.setExTime(DateUtils.getDate());
    save(krGoodUserTime);
  }

  @Override
  public Date selectExTime(String userId) {
    return this.baseMapper.selectExTime(userId);
  }
}
